# os
# copy_file_to_target('~/1.jpg',['/opt', '/mnt', '/boot'])
# import shutil
# import os
# paths = ['/opt', '/mnt', '/boot', 'day06', 'day07']
# for i in paths:
#     if not os.path.isdir(i):
#         os.makedirs(i)
#     shutil.copy('/home/student/Desktop/1.txt', i)
import os.path
import shutil

def copy_file_to_target(src_path, target_list):
    for dir in target_list:
        if not os.path.exists(dir):
            os.makedirs(dir)
        shutil.copy(src_path, dir)

copy_file_to_target('/home/student/Desktop/99.jpg',
                    ['day061', 'day062', 'day063'])

#
def rename_txt_to_log(src_dir):
    if os.path.isdir(src_dir):
        for item in os.listdir(src_dir):
            # print(item)
            if item.endswith('.txt'):

                src_path = os.path.join(src_dir, item)
                new_name = item[:-4] + '.log'

                dest_path = os.path.join(src_dir, new_name)

                os.rename(src_path, dest_path)
    else:
        print('NO dir')
rename_txt_to_log('day062')